package com.baseframe.create1.fragment;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.baseframe.create1.R;
import com.baseframe.create1.activity.ZuqiuActivity;
import com.baseframe.create1.adapter.HomeAdapter;
import com.baseframe.create1.adapter.HotuseAdapter;
import com.baseframe.create1.adapter.ZuqiuAdapter;
import com.baseframe.create1.model.HotModel;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;


@SuppressLint("ValidFragment")
public class SimpleCardFragment extends Fragment {

    @BindView(R.id.card_title_tv)
    TextView cardTitleTv;
    Unbinder unbinder;
    private String mTitle;

    HotuseAdapter hotuseAdapter;

    List<String> datas = new ArrayList<>();
    List<HotModel> hotModels = new ArrayList<>();


    public static SimpleCardFragment getInstance(String title) {
        SimpleCardFragment sf = new SimpleCardFragment();
        sf.mTitle = title;
        return sf;
    }
    @BindView(R.id.recycler_view_middle2)
    RecyclerView recycler_view_middle2;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
    ZuqiuAdapter homeAdapter;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fr_simple_card, null);
        TextView card_title_tv = (TextView) v.findViewById(R.id.card_title_tv);
        card_title_tv.setText(mTitle);

        unbinder = ButterKnife.bind(this, v);

        if (!datas.isEmpty()){
            datas.clear();
            datas.add("法甲");
            datas.add("欧冠");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("K联赛");
            datas.add("K联赛");
            datas.add("K联赛");

        }else {
            datas.add("法甲");
            datas.add("欧冠");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("J1联赛");
            datas.add("K联赛");
            datas.add("K联赛");
            datas.add("K联赛");

        }



        recycler_view_middle2.setLayoutManager(new LinearLayoutManager(getActivity()));
//        recycler_view_middle.setLayoutManager(layoutManager);
        recycler_view_middle2.setNestedScrollingEnabled(false);
        homeAdapter = new ZuqiuAdapter(getActivity(), datas);
        recycler_view_middle2.setAdapter(homeAdapter);


        return v;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}